/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package itproject.clients.gui;

import itproject.data.Customer;
import itproject.data.CustomerImpl;
import java.util.Vector;

/**
 *
 * @author tim
 */
public class EBInterfaceClient {
    
    Vector v = new Vector();

    // for testing
    public EBInterfaceClient(){
         Customer c1 = new CustomerImpl();
        c1.setFirstname("Tim");
        c1.setLastname("Schroeder");
        c1.setStreet("Bachstraße");
        c1.setZip(92345);
        c1.setCity("Ulm");

        Customer c2 = new CustomerImpl();
        c2.setFirstname("Andrea");
        c2.setLastname("Schaefer");
        c2.setStreet("Gartenweinberge");
        c2.setZip(12345);
        c2.setCity("Ludwigsburg");

        Customer c3 = new CustomerImpl();
        c3.setFirstname("Benjamin");
        c3.setLastname("Blümchen");
        c3.setStreet("Zoostrase");
        c3.setZip(32865);
        c3.setCity("Neustadt");

        Customer c4 = new CustomerImpl();
        c4.setFirstname("Donald");
        c4.setLastname("Duck");
        c4.setStreet("Ganstraße");
        c4.setZip(72865);
        c4.setCity("Entenhausen");

        v.add(c1);
        v.add(c2);
        v.add(c3);
        v.add(c4);
    
    }
    
   
    

    public Vector getAllCustomers() {

       return v;


    }
    public void createCustomer (String firstName, String lastName, String street, String zip, String city){
        
        CustomerImpl c3 = new CustomerImpl();
        c3.setFirstname(firstName);
        c3.setLastname(lastName);
        c3.setStreet(street);
        c3.setZip(Integer.parseInt(zip));
        c3.setCity(city);

        v.add(c3);
    }

    public void deleteCustomer (Customer c){
        v.remove(c);
    }

    void updateCustomer(String firstName, String lastName, String street, String zip, String city, Customer c) {
     CustomerImpl c4 = new CustomerImpl();
        c4.setFirstname(firstName);
        c4.setLastname(lastName);
        c4.setStreet(street);
        c4.setZip(Integer.parseInt(zip));
        c4.setCity(city);
     

     v.set((v.indexOf(c)), c4);


    }


}
